var reviveCount = -100;
var mapIds = [993123100];
var 准备地图 = 993123100;
var eventName = "场景_鬼怪夜市";

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance(eventName);
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully()
    }
    c.schedule("BUFF检查", 1 * 1000);
    return c
}

function onPlayerRegistered(d, c) {
    var b = new Date().getMinutes();
    var a = new Date().getHours();
    if (b >= 15 && b <= 25 && (a == 11 || a == 13 || a == 15 || a == 17 || a == 19 || a == 21)) {
        c.getMap().startSimpleMapEffect("太棒了！现在是单眼怪石像祝福时间！", 5121097);
        c.getAPI().monadForceMove("oneEye", 1, 2000);
        c.getAPI().monadForceMove("twoEye", 0, 0);
        c.getAPI().gainSkillBuff(2023876)
    } else {
        if (b >= 15 && b <= 25 && (a == 12 || a == 14 || a == 16 || a == 18 || a == 20 || a == 22)) {
            c.getAPI().getMap().startSimpleMapEffect("太棒了！现在是双眼怪石像祝福时间！", 5121098);
            c.getAPI().monadForceMove("twoEye", 1, 2000);
            c.getAPI().monadForceMove("oneEye", 0, 0);
            c.getAPI().gainSkillBuff(2023877)
        } else {
            c.getAPI().monadForceMove("oneEye", 0, 2000);
            c.getAPI().monadForceMove("twoEye", 0, 2000)
        }
    }
}

function onPlayerRevived(b, a) {
    return false
}

function onMonsterKilled(a, b) {}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
}

function BUFF检查(c) {
    c.schedule("BUFF检查", 1 * 1000);
    var b = new Date().getMinutes();
    var a = new Date().getHours();
    c.getPlayers().forEach(function (d) {
        if (b == 15 && (a == 11 || a == 13 || a == 15 || a == 17 || a == 19 || a == 21)) {
            d.getMap().startSimpleMapEffect("太棒了！现在是单眼怪石像祝福时间！", 5121097);
            d.getAPI().monadForceMove("oneEye", 1, 2000);
            d.getAPI().useItem(2023876)
        } else {
            if (b == 15 && (a == 12 || a == 14 || a == 16 || a == 18 || a == 20 || a == 22)) {
                d.getAPI().getMap().startSimpleMapEffect("太棒了！现在是双眼怪石像祝福时间！", 5121098);
                d.getAPI().monadForceMove("twoEye", 1, 2000);
                d.getAPI().useItem(2023877)
            } else {
                if (b == 25) {
                    d.getAPI().monadForceMove("oneEye", 0, 2000);
                    d.getAPI().monadForceMove("twoEye", 0, 2000)
                }
            }
        }
    })
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function openNpc(c, b, d) {
    for (var a = 0; a < c.getPlayerCount(); a++) {
        c.getPlayers().get(a).getAPI().openNpc(b, d)
    }
}

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
};